package com.xueshan.disruptor.common.event;


import com.lmax.disruptor.EventHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * created with IDEA
 *
 * @author:huqm
 * @date:2021/3/13
 * @time:21:48 <p>
 *
 * </p>
 */
@Slf4j
public class HelloEventHandler implements EventHandler<MessageModel>{

    @Override
    public void onEvent(MessageModel event, long sequence, boolean endOfBatch) throws Exception {
//        log.info("消费者处理消息开始，当前线程{}",Thread.currentThread());
        if (event != null) {
            long num = event.getValue()+1L;
//           log.info("消费者消费的信息是：{},{}",lmax.getValue()+1L,System.currentTimeMillis());
        }
//        if(endOfBatch){
//            log.info("消费者消费的信息是：{},{}",lmax.getValue()+1L,System.currentTimeMillis());
//        }
        if(sequence==500*1024*1024-1){
            log.info("消费者消费的信息是：{},{}",event.getValue()+1L,System.currentTimeMillis());
        }
    }



}
